<template>
  <div id="aCoursesList" class="bg-fa of">
    <!-- /课程详情 开始 -->

    <section class="container">
      <section class="path-wrap txtOf hLh30">
        <a href="#" title class="c-999 fsize14">首页</a>
        /
        <a href="#" title class="c-999 fsize14">课程列表</a>
        /
        <span class="c-333 fsize14">{{testdata.title}}</span>
      </section>
      <div>
        <article class="c-v-pic-wrap" style="height: 357px;">
          <section class="p-h-video-box" id="videoPlay">
            <img height="357px" :src="testdata.cover" :alt="testdata.title" class="dis c-v-pic">
          </section>
        </article>
        <aside class="c-attr-wrap">
          <section class="ml20 mr15">
            <h2 class="hLh30 txtOf mt15">
              <span class="c-fff"  style="font-size:18px;" >课程名称：</span>
              <span class="c-fff fsize24">{{testdata.title}}</span>
            </h2>
          <section class="c-attr-jg">
              <span class="c-fff">主讲人：</span>
              <b class="c-yellow" style="font-size:24px;"  >{{testdata.teacherName}}</b>
          </section>


          <section class="c-attr-jg">
              <span class="c-fff"> 课程简介：</span>
              <b class="c-fff" style="font-size:12px;">{{testdata.description}}</b>
            </section>
  
            <a :href="'/group/'+groupId" title="进入圈子" class="comm-btn c-btn-3">进入课程圈子</a>

            <section  v-if="isBuy || Number(courseWebVo.price) === 0" class="c-attr-mt">
              <a href="#" title="立即观看" class="comm-btn c-btn-3">立即观看</a>
            </section> 
          </section>
        </aside>
        <aside class="thr-attr-box">
          <!--   <ol class="thr-attr-ol clearfix"> -->
          <ol class="thr-attr-ol ">
            <li>
              <p></p>
              <aside>
                <span class="c-fff f-fM"  style="font-size:5px;">开课学期</span>
                <br>
                <h6 class="c-fff f-fM mt10">{{testdata.semester}}</h6>
              </aside>
            </li>
            <li>
              <p></p>
              <aside>
                <span class="c-fff f-fM"  style="font-size:5px;" >已选学生人数</span>
                <br>
                <h6 class="c-fff f-fM mt10">{{testdata.stuNum}}</h6>
              </aside>
            </li>
          </ol>
        </aside>
        <div class="clear"></div>
      </div>
      <!-- /课程封面介绍 -->
      <div class="mt20 c-infor-box">
        <article class="fl col-7">
          <section class="mr30">
            <div class="i-box">
              <div>
                <section id="c-i-tabTitle" class="c-infor-tabTitle c-tab-title">
                  <a name="c-i" class="current" title="课程详情">课程详情</a>
                </section>
              </div>
              <article class="ml10 mr10 pt20">
                <div>
                  <h6 class="c-i-content c-infor-title">
                    <span>课程介绍</span>
                  </h6>
                  <div class="course-txt-body-wrap">
                    <section class="course-txt-body">
                      <p >{{testdata.description}}</p>
                    </section>
                  </div>
                </div>
                <Syllabus></Syllabus>
              </article>
            </div>
          </section>
        </article>
        <aside class="fl col-3">
          <div class="i-box">
            <div>
              <section class="c-infor-tabTitle c-tab-title">
                <a title href="javascript:void(0)">主讲讲师</a>
              </section>
              <section class="stud-act-list">
                <ul style="height: auto;">
                  <li>
                    <div class="u-face">
                      <a href="#">
                        <!-- <img :src="courseWebVo.avatar" width="50" height="50" alt> -->
                      </a>
                    </div>
                    <section class="hLh30 txtOf">
                      <a class="c-333 fsize16 fl" href="#" style="font-size:24px;"  >{{testdata.teacherName}}</a>
                    </section>
                  </li>
                </ul>
              </section>
            </div>
          </div>
        </aside>
        <div class="clear"></div>
      </div>
    </section>
    <!-- /课程详情 结束 -->
  </div>
</template>

<script>
import courseApi from '@/api/course'
import orderApi from '@/api/orders'
import Syllabus from '../../components/Syllabus'

export default {
  //  asyncData({ params, error }) {
  //   return {courseId:params.id}
  //  },
   name:'courseInfo',
   components: {Syllabus},
   data(){
     return {
       testdata:{
        "courseId": "123123",
        "cover": "https://gxbfile-gs.gaoxiaobang.com/uploads/course_image/link/39a1e2861ef84e8183e9891b979f06d3.png",
        "description":  "1、首先了解学校发展情况，通过介绍学校发展的历史、现状及未来规划，办学的指导思想、发展定位与自身特色，教学、科研与管理的基本运行状况，师资队伍、学科专业和基础设施三方面的建设状况，使学生对自己就读的学校有一个宏观、全面和系统的认识。2、介绍院系及专业情况。",
        "stuNum": 1110,
        "teacherId": "",
        "teacherName":"董卓宁",
        "semester": "秋季学期",
        "title": "大学入学新生教育",
        "liveAddress": "",
        "chapterList": [
                {
                  "chapterId":1,
                  "title": "入学教育",
                  "videoList": [
                    {
                    "title": "教育1",
                    "vedioId": ""
                    },
                    {
                      "title":"教育2",
                      "vedioId":""
                    }
                  ]
                },

                {
                  "chapterId":2,
                  "title": "防火防盗",
                  "videoList": [
                   {
                    "title": "教育1",
                    "vedioId": "1"
                    },
                    {
                      "title":"教育2",
                      "vedioId":"2"
                    }]
                },
    ],
        "live|false": false,
        "groupId": "",
        "tag": 1
},

       courseWebVo: {},
       title:{},
       chapterVideoList: [],
       isBuy: false,
     }
   },

  //在页面渲染之前执行
  created(){
      // this.initCourseInfo()
  },

  methods:{
      //跳转圈子
      joinGroup(){
              //进入课程之后，跳转到课程圈子页面
              this.$router.push({path:'/group/group/'+courseId})
      
      },
      //生成订单
      createOrders(){
        orderApi.createOrders(this.courseId)
          .then(response => {
              //获取返回的订单号
              //生成订单之后，跳转到订单显示页面
              this.$router.push({path:'/orders/'+response.data.data.orderNo})
          })
      },

      initCourseInfo(){
         courseApi.getFrontCourseInfo(this.courseId)
            .then(response =>{
              this.title  =response.data.data.title;
              this.courseWebVo = response.data.data.courseWebVo
              this.chapterVideoList = response.data.data.chapterVoList
              this.isBuy = response.data.data.isBuy
            })
      }
  }
};
</script>

<style scoped>
  .el-menu-item.is-active {
      background-color: white !important;
  }
  .el-menu-item:hover {
      background-color: white !important;
  }
</style>